var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list:[],
    page:0,
    pagesize:10,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    var that = this;
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    // that.getOrder();
    
  },
  getOrder:function(){
    var that = this;
    var openid = wx.getStorageSync('openid')
    app.util.request({
      'url': 'entry/wxapp/user.qianyuelist',
      data: {
        openid: openid,
        page:that.data.page,
        pagesize:that.data.pagesize
      },
      success: function(res) {
        var page = that.data.page + 1;
        that.setData({
          list: that.data.list.concat(res.data),
          page:page
        })
      }
    })
  },
  renewpay:function(e){
    var tid = e.currentTarget.dataset.tid;
    var oid = e.currentTarget.dataset.oid;
    
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {
    this.getOrder();
  },
  // 查看团队
  teamdetail(e){
    var id = e.currentTarget.dataset.tid;
    var title = e.currentTarget.dataset.title
    wx.navigateTo({
      url: '/hyb_yl/doctor/pages/familydoctor/servercenter/servercenter?id='+id+'&title='+title,
    })
  },
  // 续签
  renewpay(){
    wx.navigateTo({
      url: '/hyb_yl/zhuanjiasubpages/pages/huanzhezhifu/huanzhezhifu',
    }) 
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {
    this.getOrder();
  },

  detail(e) {
    var that = this
    var t_id = e.currentTarget.dataset.t_id
    var sid = e.currentTarget.dataset.sid
    var key = 'zhuanjiatuandui'
    var name = e.currentTarget.dataset.name
    var teamname = e.currentTarget.dataset.teamname
    var q_id = e.currentTarget.dataset.q_id
    var ordernum = e.currentTarget.dataset.ordernum
    wx.navigateTo({
      url: '/hyb_yl/doctor/pages/familydoctor/teams/teams?t_id=' + t_id + '&sid=' + sid + '&key=' + key + '&name=' + name + '&teamname=' + teamname + '&q_id=' + q_id + '&ismyinfo=1' + '&ordernum=' + ordernum,
    })
  },
  dandetail() {
    wx.navigateTo({
      url: '/hyb_yl/zhuanjiasubpages/pages/huanzhexinxi/huanzhexinxi?myinfo=open',
    })
  }
})